package assignment

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method 'PUT'
        url value(consumer("api/v2/assignments"),
                producer("api/v2/assignments"))
        headers {
            contentType(applicationJsonUtf8())
            header('id', 21)
        }
        body("""
                [{
                    "taskId": 1 ,
                    "type": "BASIC_QUIZ" ,
                    "title": "title"
                }]
        """)
        bodyMatchers {
            jsonPath('$.[*].taskId', byRegex(number()))
            jsonPath('$.[*].type', byRegex(nonEmpty()))
            jsonPath('$.[*].title', byRegex(nonEmpty()))
        }
    }
    response {
        status 204
    }
}